using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Manager
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text = DateTime.Now.ToString();
            mapControl1.Invalidate();           
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                mapControl1.ConnectionString = Properties.Settings.Default.PoliceConnectionString;
                mapControl1.DisplayAllCars = true;
                // TODO: This line of code loads data into the 'policeDataSet.ErrorLog' table. You can move, or remove it, as needed.
                this.errorLogTableAdapter.Fill(this.policeDataSet.ErrorLog);
                // TODO: This line of code loads data into the 'policeDataSet.Incidents' table. You can move, or remove it, as needed.
                this.incidentsTableAdapter.Fill(this.policeDataSet.Incidents);
            }
            else
            {
                mapControl1.ConnectionString = null;
                label1.Text = "Timer is not running";
            }
            timer1.Enabled = checkBox1.Checked;
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'policeDataSet.ErrorLog' table. You can move, or remove it, as needed.
            this.errorLogTableAdapter.Fill(this.policeDataSet.ErrorLog);
            // TODO: This line of code loads data into the 'policeDataSet.Incidents' table. You can move, or remove it, as needed.
            this.incidentsTableAdapter.Fill(this.policeDataSet.Incidents);

        }
    }
}